﻿using _01_登录界面.Common;
using _01_登录界面.ViewModel;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;

namespace _01_登录界面.View
{
	/// <summary>
	/// Interaction logic for MainWindow.xaml
	/// </summary>
	public partial class MainView : Window
	{
		public MainView()
		{
			InitializeComponent();

			MainViewModel model=new MainViewModel();
			this.DataContext= model;

			model.UserInfo.Name = GlobalValues.UserInfo.Name;
			model.UserInfo.Gender = GlobalValues.UserInfo.Gender;



			//最大化的时候不会遮住状态栏
			this.MaxHeight = SystemParameters.PrimaryScreenHeight;

		}

		/// <summary>
		/// 窗口移动
		/// </summary>
		/// <param name="sender"></param>
		/// <param name="e"></param>
		private void Border_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
		{
			if (e.LeftButton == MouseButtonState.Pressed)
			{
				this.DragMove();
			}
        }

	

		private void ButtonMin_Click(object sender, RoutedEventArgs e)
		{
			this.WindowState = WindowState.Minimized;
		}

		private void ButtonMax_Click(object sender, RoutedEventArgs e)
		{
			this.WindowState = this.WindowState == WindowState.Maximized ? WindowState.Normal : WindowState.Maximized;
		}

		private void ButtonClose_Click(object sender, RoutedEventArgs e)
		{
			this.Close();
		}
	}
}
